{extend name="main"}
{block name="style"}
<style type="text/css">
	.flex-lable{width: 120px;color: #6c757d;text-align: right;padding-right: 10px;}
	.el-image-viewer__img{transition: all .3s; -moz-transition: all .3s; -webkit-transition: all .3s; -o-transition: all .3s;}
	.w-400px{width: 400px !important;}
	.el-drawer__body{height: 100%;}
	.RefuseWin .el-dialog{min-width: 768px;}
	.RefuseWin>.el-input, .RefuseWin>.el-select{width: 40%;}
	.el-date-editor.el-input, .el-date-editor.el-input__inner{width: 100%;}
	.el-image-viewer__mask{opacity: 1;background-color: #FFF;}
	.w-100px{width: 100px;}
</style>
{/block}
{block name="body"}
<div class="bg-white mb-3">
	<el-form :model="search" @submit.native.prevent="submitForm" ref="search" label-position="right" class="flex py-3">

	  <el-form-item label="搜索类型" prop="search_type" class="flex mb-0 pl-3">
	  	<el-select v-model="search.search_type" placeholder="请选择" class="w-100px">
		    <el-option key="uid"label="UID"value="uid"></el-option>
		    <el-option key="id_number"label="身份证或统一社会信用代码"value="id_number"></el-option>
		    <el-option key="name"label="名称"value="name"></el-option>
		</el-select>
	  </el-form-item>

	  <el-form-item label="状态" prop="status" class="flex mb-0 pl-3">
	  	<el-select v-model="search.status" placeholder="请选择" class="w-100px">
		    <el-option key="all"label="全部"value="all"></el-option>
		    <el-option :key="0"label="待审核":value="0"></el-option>
		    <el-option :key="1"label="已通过":value="1"></el-option>
		    <el-option :key="2"label="已拒绝":value="2"></el-option>
		</el-select>
	  </el-form-item>

	  <el-form-item :label="getSearchType()" prop="key" class="flex mb-0 pl-3">
	    <el-input v-model="search.key" placeholder="请输入你想搜索的关键词"></el-input>
	  </el-form-item>

	  <el-form-item class="flex mb-0 pl-3">
	    <el-button type="primary" @click="initHtml">查询</el-button>
	    <el-button @click="resetForm('search')">重置</el-button>
	  </el-form-item>
	</el-form>
</div>
<div class="bg-white p-3">
	<div class="table-responsive py-3">
		<el-button-group class="text-nowrap" style="min-width: 500px">
		  <el-button type="success" size="mini" @click="setStatusALL(1)">批量通过</el-button>
		  <el-button type="danger" size="mini" @click="openRefuseWin(2)">批量拒绝</el-button>
		</el-button-group>
	</div>
	<div class="table-responsive">
		<el-table
			ref="tableList"
	      	:data="tableData"
    		stripe
    		v-loading="search.ajax"
    		style="width: 100%;"
    		row-class-name="row-flex"
    		@selection-change="handleSelectionChange">
		  <el-table-column
			  type="selection"
			  :selectable="checkboxT"
	      	  disabled="true"
			  width="55">
		  </el-table-column>
    		<el-table-column type="expand" width="20">
		      <template slot-scope="scope">
		      	<div class="flex">
		      		<div class="flex-1">
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">UID</div>
		      				<div class="flex-1">{{scope.row.uid}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">用户</div>
							<el-image
							  	v-if="scope.row.headimg" 
							    style="width: 30px; height: 30px"
							    lazy
							    class="rounded-circle mr-2"
							    :src="scope.row.headimg" 
							    :preview-src-list="[scope.row.headimg]">
							</el-image>
		      				<div class="flex-1">
								{{scope.row.nickname}}
		      				</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">名称</div>
		      				<div class="flex-1">{{scope.row.name}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">身份证或统一社会信用代码</div>
		      				<div class="flex-1">{{scope.row.id_number}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">联系人</div>
		      				<div class="flex-1">{{scope.row.contacts}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">手机号</div>
		      				<div class="flex-1">{{scope.row.mobile}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">地址</div>
		      				<div class="flex-1">{{scope.row.area1}}{{scope.row.area2}}{{scope.row.area3}}{{scope.row.address}}</div>
		      			</div>
		      		</div>
		      		<div class="flex-1">
						<div class="py-2 border-bottom mb-2" v-for="(v,index) in scope.row.log">
							<div class="flex">
								<div class="text-secondary" v-if="v.status===0">提交申请</div>
								<div class="text-success" v-if="v.status===1">审核通过</div>
								<div class="text-danger" v-if="v.status===2">被驳回</div>
								<div class="flex-1 pl-2">{{v.nickname}}</div>
								<div class="small text-secondary">{{v.create_time}}</div>
							</div>
							<div class="pt-2">{{v.msg}}</div>
						</div>
		      		</div>
		      	</div>
		      </template>
		    </el-table-column>
	      <el-table-column
	        prop="uid"
	        label="UID"
	        width="100">
	      </el-table-column>
	      <el-table-column
	        label="用户"
	        min-width="180">
		      <template slot-scope="scope">
		      	<div class="flex flex-center">
					<el-image
					  	v-if="scope.row.headimg" 
					    style="width: 30px; height: 30px"
					    lazy
					    class="rounded-circle mr-2"
					    :src="scope.row.headimg" 
					    :preview-src-list="[scope.row.headimg]">
					</el-image>
		      		<div>
						{{scope.row.nickname}}
		      		</div>
		      	</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label=身份类型
	        width="80">
		      <template slot-scope="scope">
	      		<span class="text-info" v-if="scope.row.id_type==0">个人</span>
	      		<span class="text-primary" v-if="scope.row.id_type==1">企业</span>
	      		<span class="text-secondary" v-if="scope.row.id_type==2">其他组织</span>
		      </template>
	      </el-table-column>
	      <el-table-column
	      	prop="name"
	        label="名称"
	        min-width="200">
	      </el-table-column>
	      <el-table-column
	      	prop="id_number"
	        label="身份证或统一社会信用代码"
	        width="240">
		      <template slot-scope="scope">
		      	<el-link type="primary" :href="'http://www.gsxt.gov.cn/corp-query-search-1.html?searchword='+scope.row.id_number" :underline="false" v-if="scope.row.id_type==1" target="_blank">{{scope.row.id_number}}</el-link>
		      	<el-link type="info" :underline="false" v-else>{{scope.row.id_number}}</el-link>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="图片"
	        width="80">
		      <template slot-scope="scope">
		      	<el-link type="primary" @click="openImageViewer(scope.$index);" :underline="false" v-if="scope.row.img1||scope.row.img2||scope.row.img3||scope.row.img4||scope.row.img5">查看({{getImgSum(scope.row)}})</el-link>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="状态"
	        width="80">
		      <template slot-scope="scope">
		      	<transition>
		      		<span class="text-success" v-if="scope.row.status==1">正常</span>
		      		<span class="text-danger" v-else-if="scope.row.status==2">拒绝</span>
		      		<span class="text-secondary" v-else-if="scope.row.status=='loading'" :loading="true">加载中</span>
		      		<span class="text-secondary" v-else>待审核</span>
				</transition>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="创建/更新时间"
	        width="180">
		      <template slot-scope="scope">
		      	<div class="small">
		          <div>{{ scope.row.create_time }}</div>
		          <div>{{ scope.row.update_time }}</div>
		      	</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="/"
	        width="180">
		      <template slot-scope="scope">
						<el-button-group class="text-nowrap" v-if="scope.row.status===0">
						  <el-button type="success" size="mini" @click="setStatus(scope.row,1)" :loading="scope.row.status=='loading'">通过</el-button>
						  <el-button type="danger" size="mini" @click="openRefuseWin(1,scope)" :loading="scope.row.status=='loading'">拒绝</el-button>
						</el-button-group>
					  <el-button type="info" size="mini" @click="openRefuseWin(1,scope)" :loading="scope.row.status=='loading'" plain round
					  v-if="scope.row.status===1">取消实名</el-button>
		      </template>
	      </el-table-column>
	    </el-table>
	</div>
	<div class="table-responsive py-3">
		<el-button-group class="text-nowrap" style="min-width: 500px">
		  <el-button type="success" size="mini" @click="setStatusALL(1)">批量通过</el-button>
		  <el-button type="danger" size="mini" @click="openRefuseWin(2)">批量拒绝</el-button>
		</el-button-group>
	</div>
	<div class="table-responsive py-3 text-center">
		<el-pagination
		  background
	      @size-change="handleSizeChange"
	      @current-change="handleCurrentChange"
	      :current-page="search.page"
	      :page-sizes="[10,50,100,200]"
	      :page-size="search.pageSize"
	      layout="total, sizes, prev, pager, next, jumper"
	      :total="search.total">
	    </el-pagination>
	</div>
</div>
<el-dialog
  title=""
  :visible.sync="dialogVisible"
  width="700px"
  :with-header="false"
  @close="cancelRefuseWinSubmit();">
		<el-form :model="form" label-width="120px" :rules="rules" ref="form" size="small">
			  <el-form-item label="名称" v-if="rowDataIndex!==null">{{rowData.name}}</el-form-item>
			  <el-form-item label="身份证或统一社会信用代码" v-if="rowDataIndex!==null">
	      	<el-link type="primary" :href="'http://www.gsxt.gov.cn/corp-query-search-1.html?searchword='+rowData.id_number" :underline="false" v-if="rowData.id_type==1" target="_blank">{{rowData.id_number}}</el-link>
	      	<el-link type="info" :underline="false" v-else>{{rowData.id_number}}</el-link>
		    </el-form-item>
			  <el-form-item label="证件照片" v-if="rowDataIndex!==null">
			  	<div class="flex text-center">
			  		<div class="px-1" v-if="rowData.img3">
							<el-image
						    style="width: 100px; height: 120px;cursor: pointer;"
						    class="border"
						    :src="rowData.img3"
						    fit="cover"
						    @click="openImageViewer(rowDataIndex);"></el-image>
						    <div class="small">营业执照</div>
			  		</div>
			  		<div class="px-1" v-if="rowData.img1">
							<el-image
						    style="width: 100px; height: 120px;cursor: pointer;"
						    :src="rowData.img1"
						    fit="cover"
						    @click="openImageViewer(rowDataIndex);"></el-image>
						    <div class="small">身份证正面</div>
			  		</div>
			  		<div class="px-1" v-if="rowData.img2">
							<el-image
						    style="width: 100px; height: 120px;cursor: pointer;"
						    :src="rowData.img2"
						    fit="cover"
						    @click="openImageViewer(rowDataIndex);"></el-image>
						    <div class="small">身份证反面</div>
			  		</div>
			  		<div class="px-1" v-if="rowData.img4">
							<el-image
						    style="width: 100px; height: 120px;cursor: pointer;"
						    :src="rowData.img4"
						    fit="cover"
						    @click="openImageViewer(rowDataIndex);"></el-image>
						    <div class="small">承诺函</div>
			  		</div>
			  		<div class="px-1" v-if="rowData.img5">
							<el-image
						    style="width: 100px; height: 120px;cursor: pointer;"
						    :src="rowData.img5"
						    fit="cover"
						    @click="openImageViewer(rowDataIndex);"></el-image>
						    <div class="small">补充材料</div>
			  		</div>
			  	</div>
			  	<div class="pt-2 text-secondary">
			  		<i class="el-icon-warning-outline mr-1 text-primary"></i>
			  		说明：点击图片查看原图
			  	</div>
			  </el-form-item>
			  <el-form-item label="审核"><span class="small text-danger">驳回申请</span></el-form-item>
			  <el-form-item label="驳回原因" prop="msg">
				  <el-input type="textarea" v-model="form.msg" class="col-12 pl-0 pr-0" :autosize="{ minRows: 4, maxRows: 20}" maxlength="200" show-word-limit></el-input>
			  </el-form-item>
		</el-form>
		<div class="pointer text-primary small py-1" @click="showLog= !showLog;">{{showLog?'收起日志':'查看日志'}}</div>
	  <div v-show="showLog" style="max-height:400px;overflow-y: auto;">
			<div class="py-2 border-bottom mb-2" v-for="(v,index) in rowData.log">
				<div class="flex">
					<div class="text-secondary" v-if="v.status===0">提交申请</div>
					<div class="text-success" v-if="v.status===1">审核通过</div>
					<div class="text-danger" v-if="v.status===2">被驳回</div>
					<div class="flex-1 pl-2">{{v.nickname}}</div>
					<div class="small text-secondary">{{v.create_time}}</div>
				</div>
				<div class="pt-2">{{v.msg}}</div>
			</div>
	  </div>
		<div slot="footer">
		    <el-button @click="cancelRefuseWinSubmit();" size="mini">取 消</el-button>
		    <el-button type="primary" @click="submitForm('form');" :loading="form.ajax" size="mini">{{form.ajax?'提交中...':'提交'}}</el-button>
		</div>
</el-dialog>
<div class="el-image-viewer__wrapper" style="z-index: 20000;" v-if="viewer.index !== null">
	<div class="el-image-viewer__mask"></div>
	<span class="el-image-viewer__btn el-image-viewer__close" @click="closeImageViewer">
		<i class="el-icon-circle-close text-dark h4 mb-0"></i>
	</span>
	<span class="el-image-viewer__btn el-image-viewer__prev" @click="viewerPrev">
		<i class="el-icon-arrow-left"></i>
	</span>
	<span class="el-image-viewer__btn el-image-viewer__next" @click="viewerNext">
		<i class="el-icon-arrow-right"></i>
	</span>
	<div class="el-image-viewer__btn el-image-viewer__actions" :class="{'w-400px':tableData[viewer.index].status===0}">
		<div class="el-image-viewer__actions__inner" >
			<i class="el-icon-refresh" @click="viewerZoomRest"></i>
			<i class="el-icon-zoom-out" @click="viewerZoomOut"></i>
			<i class="el-icon-zoom-in" @click="viewerZoomIn"></i>
			<i class="el-image-viewer__actions__divider"></i>
			<i class="el-icon-full-screen" v-if="viewer.is_screen" @click="viewerIsScreen"></i>
			<i class="el-icon-c-scale-to-original" v-else @click="viewerIsScreen"></i>
			<i class="el-image-viewer__actions__divider"></i>
			<i class="el-icon-refresh-left" @click="viewerRotateLeft"></i>
			<i class="el-icon-refresh-right" @click="viewerRotateRight"></i>
			<i class="el-image-viewer__actions__divider" v-if="tableData[viewer.index].status===0"></i>
			<el-button-group class="text-nowrap" v-if="tableData[viewer.index].status===0">
			  <el-button type="success" size="mini" @click="setStatus(tableData[viewer.index],1,viewerNext())" icon="el-icon-check" round></el-button>
			  <el-button type="danger" size="mini" @click="openRefuseWinForViewer(3,tableData[viewer.index]);" icon="el-icon-close" round></el-button>
			</el-button-group>
		  <el-button v-if="tableData[viewer.index].status===1" type="info" size="mini" @click="openRefuseWinForViewer(1,tableData[viewer.index])" icon="el-icon-delete" round></el-button>
		</div>
	</div>
	<div class="wrap h-100 w-100">
		<div class="text-center py-2 bg-white position-relative text" >
      		<span class="text-primary mr-2" v-if="tableData[viewer.index].id_type==0">个人</span>
      		<span class="text-primary mr-2" v-if="tableData[viewer.index].id_type==1">企业</span>
      		<span class="text-primary mr-2" v-if="tableData[viewer.index].id_type==2">其他组织</span>【{{tableData[viewer.index].name}}】{{tableData[viewer.index].id_number}}
		</div>
		<div class="flex1 flex">
			<div class="el-image-viewer__canvas" v-if="tableData[viewer.index].img1">
				<img :src="tableData[viewer.index].img1" class="el-image-viewer__img" :style="getViewerStyle(1)" ref="viewerImage1" @mousewheel="viewerMousewheel($event,1)">
			</div>
			<div class="el-image-viewer__canvas" v-if="tableData[viewer.index].img2">
				<img :src="tableData[viewer.index].img2" class="el-image-viewer__img" :style="getViewerStyle(2)" ref="viewerImage2" @mousewheel="viewerMousewheel($event,2)">
			</div>
			<div class="el-image-viewer__canvas" v-if="tableData[viewer.index].img3">
				<img :src="tableData[viewer.index].img3" class="el-image-viewer__img" :style="getViewerStyle(3)" ref="viewerImage3" @mousewheel="viewerMousewheel($event,3)">
			</div>
			<div class="el-image-viewer__canvas" v-if="tableData[viewer.index].img4">
				<img :src="tableData[viewer.index].img4" class="el-image-viewer__img" :style="getViewerStyle(4)" ref="viewerImage4" @mousewheel="viewerMousewheel($event,4)">
			</div>
			<div class="el-image-viewer__canvas" v-if="tableData[viewer.index].img5">
				<img :src="tableData[viewer.index].img5" class="el-image-viewer__img" :style="getViewerStyle(5)" ref="viewerImage5" @mousewheel="viewerMousewheel($event,5)">
			</div>
			<div class="el-image-viewer__canvas text-dark" v-if="!tableData[viewer.index].img1&&!tableData[viewer.index].img2&&!tableData[viewer.index].img3&&!tableData[viewer.index].img4&&!tableData[viewer.index].img5">
				<div class="el-image-viewer__img" style="z-index:1">无认证图片</div>
			</div>
		</div>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
	var loading=null;
	var vm=new Vue({
		el:'#app',
		data:{
			view:XYBase.view,
			labelPosition:'right',
			showLog:false,
			dialogVisible:false,
			viewer:{
				index:null,
				scale1:1,
				scale2:1,
				scale3:1,
				scale4:1,
				scale5:1,
				rotate:0,
				isDown:false,
				is_screen:true
			},
			multipleSelection:[],
			multipleSelectionIndex:0,
			search:{
				search_type:'uid',
				key:'{:request()->get('uid')}',
				status:{:request()->get('status',"\'all\'")},
				id_type:1,
				ajax:false,
				page:1,
				total:0,
				pageSize:10
			},
			rowDataIndex:null,
			rowData:{},
			form:{
				ajax:false,
				type:1,
				msg:''
			},
			tableData:[],
	        rules: {
	          msg: [
	            { required: true, message: '请输入审核结果', trigger: 'blur' },
	          ],
	        }
		},
		watch:{
		    view:XYBase.viewWatch,
		},
		created(){
			XYBase.created(this);
		},
	    methods: {
	    	getImgSum(row){
	    		var sum=0;
	    		if (row.img1) sum++;
	    		if (row.img2) sum++;
	    		if (row.img3) sum++;
	    		if (row.img4) sum++;
	    		if (row.img5) sum++;
	    		return sum;
	    	},
			checkboxT(row,index){
	    		if(row.status==0){
	    			return true;
	    		}else{
	    			return false;
	    		}
	    	},
		    toggleSelection(rows) {
		        if (rows) {
		          rows.forEach(row => {
		            this.$refs.tableList.toggleRowSelection(row);
		          });
		        } else {
		          this.$refs.tableList.clearSelection();
		        }
		    },
		    handleSelectionChange(val) {
		        this.multipleSelection = val;
		    },
	    	getSearchType(){
	    		var text='UID';
	    		switch(this.search.search_type){
	    			case 'uid':
	    				text='UID';
	    				break;
	    			case 'id_number':
	    				text='身份证或统一社会信用代码';
	    				break;
	    			case 'name':
	    				text='名称';
	    				break;
	    		}
	    		return text;
	    	},
	    	getViewerStyle(index){
	    		var scale=1;
	    		switch(index){
	    			case 1:
	    			scale=this.viewer.scale1;
	    			break;
	    			case 2:
	    			scale=this.viewer.scale2;
	    			break;
	    			case 3:
	    			scale=this.viewer.scale3;
	    			break;
	    			case 4:
	    			scale=this.viewer.scale4;
	    			break;
	    			case 5:
	    			scale=this.viewer.scale5;
	    			break;
	    		}
	    		var style={
	    			transform:'scale('+scale+') rotate('+this.viewer.rotate+'deg)'
	    		};
	    		if (this.viewer.is_screen) {
	    			style.maxHeight='100%';
	    			style.maxWidth='100%';
	    		}
	    		return style;
	    	},
	    	closeImageViewer(){
	    		document.getElementsByClassName('body')[0].style='';
	    		this.viewer.index=null;
	    	},
	    	openImageViewer(index){
	    		document.getElementsByClassName('body')[0].style="overflow: hidden;padding-right:17px;";
	    		this.viewer.index=index;
	    		this.viewer.scale1=1;
	    		this.viewer.scale2=1;
	    		this.viewer.scale3=1;
	    		this.viewer.scale4=1;
	    		this.viewer.scale5=1;
	    		this.viewer.rotate=0;
	    		this.viewer.is_screen=true;
	    	},
	    	viewerMousewheel(event,index){
	    		var scale=1;
	    		switch(index){
	    			case 1:
	    			scale=this.viewer.scale1;
	    			break;
	    			case 2:
	    			scale=this.viewer.scale2;
	    			break;
	    			case 3:
	    			scale=this.viewer.scale3;
	    			break;
	    			case 4:
	    			scale=this.viewer.scale4;
	    			break;
	    			case 5:
	    			scale=this.viewer.scale5;
	    			break;
	    		}
	    		if (event.deltaY>0) {
	    			if (scale<=0.2)return;
	    			scale=scale-0.02;
	    		}else{
	    			scale=scale+0.02;
	    		}
	    		switch(index){
	    			case 1:
	    			this.viewer.scale1=scale;
	    			break;
	    			case 2:
	    			this.viewer.scale2=scale;
	    			break;
	    			case 3:
	    			this.viewer.scale3=scale;
	    			break;
	    			case 4:
	    			this.viewer.scale4=scale;
	    			break;
	    			case 5:
	    			this.viewer.scale5=scale;
	    			break;
	    		}
	    	},
	    	viewerZoomRest(){
	    		this.viewer.scale1=1;
	    		this.viewer.scale2=1;
	    		this.viewer.scale3=1;
	    		this.viewer.scale4=1;
	    		this.viewer.scale5=1;
	    		this.viewer.rotate=0;
	    	},
	    	viewerZoomOut(){
	    		if (this.viewer.scale1>0.3)
	    		this.viewer.scale1=this.viewer.scale1-0.2;
	    		if (this.viewer.scale2>0.3)
	    		this.viewer.scale2=this.viewer.scale2-0.2;
	    		if (this.viewer.scale3>0.3)
	    		this.viewer.scale3=this.viewer.scale3-0.2;
	    		if (this.viewer.scale4>0.3)
	    		this.viewer.scale4=this.viewer.scale4-0.2;
	    		if (this.viewer.scale5>0.3)
	    		this.viewer.scale5=this.viewer.scale5-0.2;
	    	},
				viewerZoomIn(){
	    		this.viewer.scale1=this.viewer.scale1+0.2;
	    		this.viewer.scale2=this.viewer.scale2+0.2;
	    		this.viewer.scale3=this.viewer.scale3+0.2;
	    		this.viewer.scale4=this.viewer.scale4+0.2;
	    		this.viewer.scale5=this.viewer.scale5+0.2;
				},
	    	viewerIsScreen(index){
	    		this.viewer.scale1=1;
	    		this.viewer.scale2=1;
	    		this.viewer.scale3=1;
	    		this.viewer.scale4=1;
	    		this.viewer.scale5=1;
	    		this.viewer.rotate=0;
	    		this.viewer.is_screen= !this.viewer.is_screen;
	    	},
	    	viewerRotateLeft(){
	    		this.viewer.rotate=this.viewer.rotate-90;
	    	},
			viewerRotateRight(){
	    		this.viewer.rotate=this.viewer.rotate+90;
			},
			viewerNext(){
				var index=this.viewer.index;
				if (this.tableData[this.viewer.index+1])
					this.viewer.index++;
				else
					XYBase.msg('已经是最后一张了');
				this.cancelRefuseWinSubmit();
			},
			viewerPrev(){
				var index=this.viewer.index;
				if (this.tableData[this.viewer.index-1])
					this.viewer.index--;
				else
					XYBase.msg('已经是第一张了');
				this.cancelRefuseWinSubmit();
			},
			resetForm:function(formName) {
				this.$refs[formName].resetFields();
			},
			handleSizeChange(val) {
				this.search.page=1;
				this.search.pageSize=val;
	          	this.initHtml();
			},
    	cancelRefuseWinSubmit(){
    		this.rowDataIndex=null;
				this.dialogVisible=false;
    	},
    	openRefuseWinForViewer(type,data){
    		this.openRefuseWin(type,{
    			row:data,
    			$index:this.viewer.index
    		});
    	},
			openRefuseWin(type,scope){
				this.form.type=type;
				if (type===1 || type===3){
					this.rowData=scope.row;
					this.rowDataIndex=scope.$index;
				}
	    	this.viewer.index=null;
				this.dialogVisible=true;
			},
			submitForm(formName) {
				var _this=this;
				_this.$refs[formName].validate((valid) => {
				  if (valid) {
				  	_this.form.ajax=true;
				  	if (_this.form.type===2) {
					  	_this.form.ajax=false;
						_this.dialogVisible=false;
				  		_this.setStatusALL(2);
				  	}else{
					  	_this.setStatus(_this.rowData,2,function(){
						  	_this.form.ajax=false;
							_this.dialogVisible=false;
						  	if (_this.form.type===3)
						  		_this.viewerNext();
					  	});
				  	}
				  } else {
					return XYBase.warning('请先把表单填写完整。');
				  }
				});
			},
			setStatus(row,status,callback){
	    		if (row.status=='loading') return;
				var _this=this;
	    		var oldStatus=row.status;
	    		row.status='loading';
				$.ajax({
					url:'/user/real_name/setStatus',
					type:'post',
					data:{
						id:row.id,
						status:status,
						msg:_this.form.msg
					},
					dataType:'json',
					error:function(err){
	    				row.status=oldStatus;
			          	XYBase.error(XYBase.config.system_network_error);
					},
					success:function(ret){
	    				row.status=oldStatus;
						if (ret) {
							if (ret.code === 0) {
								row.status=status;
								row.update_time=ret.time;
								if (status==2)
									row.msg=_this.form.msg;
								XYBase.success(ret.msg);
								if (typeof callback=='function')
									callback();
							}else XYBase.msg(ret.msg);
						}else XYBase.error(XYBase.config.system_network_error);
					}
				})
			},
			setStatusALL(status){
				var _this=this;
				if (_this.multipleSelection.length<1)return;
				loading = XYBase.openloading();
				_this.multipleSelectionIndex=0;
				_this.setStatusALLAjax(status);
			},
			setStatusALLAjax(status){
				var _this=this;
				var D=_this.multipleSelection[_this.multipleSelectionIndex];
				if (D) {
					loading.setText((_this.multipleSelectionIndex+1)+'/'+_this.multipleSelection.length);
					$.ajax({
						url:'/user/real_name/setStatus',
						type:'post',
						data:{
							id:D.id,
							status:status,
							msg:_this.form.msg
						},
						dataType:'json',
						error:function(err){
				          	loading.close();
							_this.multipleSelectionIndex=0;
					        _this.$refs.tableList.clearSelection();
						},
						success:function(ret){
							if (ret) {
								if(ret.code === 0){
									_this.multipleSelection[_this.multipleSelectionIndex].status=status;
									_this.multipleSelection[_this.multipleSelectionIndex].update_time=ret.time;
									if (status==2)
										_this.multipleSelection[_this.multipleSelectionIndex].msg=_this.form.msg;
									_this.multipleSelectionIndex++;
									_this.setStatusALLAjax(status);
								}else{
									_this.multipleSelectionIndex++;
									_this.setStatusALLAjax(status);
								}
							}else{
								XYBase.error(XYBase.config.system_network_error);
					          	loading.close();
								_this.multipleSelectionIndex=0;
						        _this.$refs.tableList.clearSelection();
							}
						}
					})
				}else{
		      loading.close();
					_this.multipleSelectionIndex=0;
			    _this.$refs.tableList.clearSelection();
			    window.location.reload();
				}
			},
			handleCurrentChange(val) {
				this.search.page=val;
	          	this.initHtml();
			},
	      	initHtml() {
	      		var _this=this;
	      		_this.search.ajax=true;
				$.ajax({
					url:'/user/real_name',
					type:'get',
					data:_this.search,
					dataType:'json',
					error:function(err){
	      				_this.search.ajax=false;
						XYBase.error(XYBase.config.system_network_error);
					},
					success:function(ret){
	      				_this.search.ajax=false;
						if (ret) {
							if (ret.code === 0) {
								_this.search.total=ret.data.total;
								_this.tableData=ret.data.data;
							}else{
								XYBase.msg(ret.msg);
							}
						}else{
							XYBase.error(XYBase.config.system_network_error);
						}
					}
				});
			}
	    }
	});
	$(function(){
		vm.initHtml();
		reloadWindowSize();
		$(window).resize(function(){
			reloadWindowSize();
		});
	});
	function reloadWindowSize (argument) {
		var winW=$(window).width();
		if(winW <= 576){
			vm.labelPosition='top';
		}else{
			vm.labelPosition='right';
		}
	}
</script>
{/block}